#pragma once
#include <vector>
#include <d3dx9.h>
#include <d3d9.h>
using namespace std;

class cWindowedTraits
{
public:
	cWindowedTraits(){
		TypeArr.push_back(false);
		TypeArr.push_back(true);

		TypeStr.push_back(L"FALSE");
		TypeStr.push_back(L"TRUE");
	}
	vector<bool> TypeArr;
	vector<WCHAR*> TypeStr;
};

class cFMTTraits
{
public:
	cFMTTraits(){
		TypeArr.push_back(D3DFMT_X8R8G8B8);TypeArr.push_back(D3DFMT_R5G6B5);
		TypeArr.push_back(D3DFMT_X1R5G5B5);TypeArr.push_back(D3DFMT_A1R5G5B5);
		TypeArr.push_back(D3DFMT_A8R8G8B8);TypeArr.push_back(D3DFMT_A2R10G10B10);
		TypeArr.push_back(D3DFMT_D16);TypeArr.push_back(D3DFMT_D24X8);
		TypeArr.push_back(D3DFMT_D24X4S4);TypeArr.push_back(D3DFMT_D15S1);
		TypeArr.push_back(D3DFMT_D24S8);TypeArr.push_back(D3DFMT_D32);

		TypeStr.push_back(L"D3DFMT_X8R8G8B8");TypeStr.push_back(L"D3DFMT_R5G6B5");
		TypeStr.push_back(L"D3DFMT_X1R5G5B5");TypeStr.push_back(L"D3DFMT_A1R5G5B5");
		TypeStr.push_back(L"D3DFMT_A8R8G8B8");TypeStr.push_back(L"D3DFMT_A2R10G10B10");
		TypeStr.push_back(L"D3DFMT_D16");TypeStr.push_back(L"D3DFMT_D24X8");
		TypeStr.push_back(L"D3DFMT_D24X4S4");TypeStr.push_back(L"D3DFMT_D15S1");
		TypeStr.push_back(L"D3DFMT_D24S8");TypeStr.push_back(L"D3DFMT_D32");
	}
	vector<D3DFORMAT> TypeArr;
	vector<WCHAR*> TypeStr;
};

class cDevTypeTraits
{
public:
	cDevTypeTraits(){
		TypeArr.push_back(D3DDEVTYPE_HAL);TypeArr.push_back(D3DDEVTYPE_REF);
		TypeArr.push_back(D3DDEVTYPE_SW);

		TypeStr.push_back(L"D3DDEVTYPE_HAL");TypeStr.push_back(L"D3DDEVTYPE_REF");
		TypeStr.push_back(L"D3DDEVTYPE_SW");
	}
	vector<D3DDEVTYPE> TypeArr;
	vector<WCHAR*> TypeStr;
};

class cMSTypeTraits
{
public:
	cMSTypeTraits(){
		TypeArr.push_back(D3DMULTISAMPLE_NONE);
		TypeArr.push_back(D3DMULTISAMPLE_NONMASKABLE);
		TypeArr.push_back(D3DMULTISAMPLE_2_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_3_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_4_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_5_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_6_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_7_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_8_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_9_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_10_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_11_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_12_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_13_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_14_SAMPLES);
		TypeArr.push_back(D3DMULTISAMPLE_15_SAMPLES);

		TypeStr.push_back(L"D3DMULTISAMPLE_NONE");
		TypeStr.push_back(L"D3DMULTISAMPLE_NONMASKABLE");
		TypeStr.push_back(L"D3DMULTISAMPLE_2_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_3_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_4_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_5_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_6_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_7_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_8_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_9_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_10_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_11_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_12_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_13_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_14_SAMPLES");
		TypeStr.push_back(L"D3DMULTISAMPLE_15_SAMPLES");

	}
	vector<D3DMULTISAMPLE_TYPE> TypeArr;
	vector<WCHAR*> TypeStr;
};

class cPITraits
{
public:
	cPITraits(){
		TypeArr.push_back(D3DPRESENT_INTERVAL_IMMEDIATE);
		TypeArr.push_back(D3DPRESENT_INTERVAL_DEFAULT);
		TypeArr.push_back(D3DPRESENT_INTERVAL_ONE);
		TypeArr.push_back(D3DPRESENT_INTERVAL_TWO);
		TypeArr.push_back(D3DPRESENT_INTERVAL_THREE);
		TypeArr.push_back(D3DPRESENT_INTERVAL_FOUR);

		TypeStr.push_back(L"D3DPRESENT_INTERVAL_IMMEDIATE");
		TypeStr.push_back(L"D3DPRESENT_INTERVAL_DEFAULT");
		TypeStr.push_back(L"D3DPRESENT_INTERVAL_ONE");
		TypeStr.push_back(L"D3DPRESENT_INTERVAL_TWO");
		TypeStr.push_back(L"D3DPRESENT_INTERVAL_THREE");
		TypeStr.push_back(L"D3DPRESENT_INTERVAL_FOUR");
	}
	vector<UINT> TypeArr;
	vector<WCHAR*> TypeStr;
};

class cVPTraits
{
public:
	cVPTraits(){
		TypeArr.push_back(D3DCREATE_HARDWARE_VERTEXPROCESSING);
		TypeArr.push_back(D3DCREATE_SOFTWARE_VERTEXPROCESSING);
		TypeArr.push_back(D3DCREATE_MIXED_VERTEXPROCESSING);
		TypeArr.push_back(D3DCREATE_PUREDEVICE);

		TypeStr.push_back(L"HARDWARE_VERTEXPROCESSING");
		TypeStr.push_back(L"SOFTWARE_VERTEXPORCESSING");
		TypeStr.push_back(L"MIXED_VERTEXPROCESSING");
		TypeStr.push_back(L"D3DCREATE_PUREDEVICE");
	}
	vector<DWORD> TypeArr;
	vector<WCHAR*> TypeStr;
};

template<typename Type,typename Traits>
class cGetor:public Traits
{
public:
	WCHAR* GetStr(Type in){
		for(int i = 0;i<TypeArr.size();++i)
		{
			if(TypeArr[i]==in)
				return TypeStr[i];
		}
		return L"";
	}
	Type GetType(WCHAR* in){
		for(int i = 0;i<TypeStr.size();++i)
		{
			if(wcscmp(in,TypeStr[i])==0)
				return TypeArr[i];
		}
		return Type(0);
	}
};
